﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="{x:Type RadioButton}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="{DynamicResource RadioButtonContentForegroundThemeBrush}" />
        <Setter Property="BorderBrush" Value="{x:Null}" />
        <Setter Property="Padding" Value="1,4,0,0" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
        <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                             SnapsToDevicePixels="True">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="29" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Ellipse x:Name="BackgroundEllipse" Margin="3,3,3,3" Width="23" Height="23" Fill="{DynamicResource RadioButtonBackgroundThemeBrush}" Stroke="{DynamicResource RadioButtonBorderThemeBrush}"
                                     StrokeThickness="{DynamicResource RadioButtonBorderThemeThickness}" UseLayoutRounding="True" VerticalAlignment="Top" />
                            <Ellipse x:Name="CheckGlyph" Margin="0,8,8,0" Width="13" Height="13" Opacity="0" Fill="{DynamicResource RadioButtonForegroundThemeBrush}" VerticalAlignment="Top"
                                     HorizontalAlignment="Right" />
                            <Rectangle x:Name="FocusVisualWhite" Stroke="{DynamicResource FocusVisualWhiteStrokeThemeBrush}" Opacity="0"
                                       Width="29" Height="29" VerticalAlignment="Top" />
                            <Rectangle x:Name="FocusVisualBlack" Stroke="{DynamicResource FocusVisualBlackStrokeThemeBrush}" Opacity="0"
                                       Width="29" Height="29" VerticalAlignment="Top" />
                            <ContentControl x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="1" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>

                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="BackgroundEllipse" Property="Fill" Value="{DynamicResource RadioButtonPointerOverBackgroundThemeBrush}" />
                            <Setter TargetName="BackgroundEllipse" Property="Stroke" Value="{DynamicResource RadioButtonPointerOverBorderThemeBrush}" />
                            <Setter TargetName="CheckGlyph" Property="Fill" Value="{DynamicResource RadioButtonPointerOverForegroundThemeBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="BackgroundEllipse" Property="Fill" Value="{DynamicResource RadioButtonDisabledBackgroundThemeBrush}" />
                            <Setter TargetName="BackgroundEllipse" Property="Stroke" Value="{DynamicResource RadioButtonDisabledBorderThemeBrush}" />
                            <Setter TargetName="CheckGlyph" Property="Fill" Value="{DynamicResource RadioButtonDisabledForegroundThemeBrush}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource RadioButtonContentDisabledForegroundThemeBrush}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="BackgroundEllipse" Property="Fill" Value="{DynamicResource RadioButtonPressedBackgroundThemeBrush}" />
                            <Setter TargetName="BackgroundEllipse" Property="Stroke" Value="{DynamicResource RadioButtonPressedBorderThemeBrush}" />
                            <Setter TargetName="CheckGlyph" Property="Fill" Value="{DynamicResource RadioButtonPressedForegroundThemeBrush}" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="CheckGlyph" Property="Opacity" Value="1" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="FocusVisualWhite" Property="Opacity" Value="1" />
                            <Setter TargetName="FocusVisualBlack" Property="Opacity" Value="1" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter TargetName="FocusVisualWhite" Property="Opacity" Value="1" />
                            <Setter TargetName="FocusVisualBlack" Property="Opacity" Value="1" />
                            <Setter TargetName="FocusVisualWhite" Property="Stroke" Value="{DynamicResource ControlValidationInvalidThemeBrush}" />
                            <Setter TargetName="FocusVisualBlack" Property="Stroke" Value="{DynamicResource ControlValidationInvalidThemeBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>